-- apper_petrify
-- created by xinj
-- 开格子概率石化

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 开格子
    trigger = function(who, prop, arg)
        local grid = arg;

        -- 不是怪物
        if not grid:isMonster() then
            return false;
        end

        -- 概率没发生
        if DungeonM.getRandSeed("apper_petrify") % 1000 >= prop[3] then
            return false;
        end

        local condition = {
            ["id"] = PropM.getPropId("petrifaction"),
            ["end_round"] = CombatM.getRound() + prop[4] + 1,
        };
        -- 附加状态
        CombatStatusM.applyStatus(grid.monster, "petrifaction", condition);

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};